﻿using System;
using System.Drawing;
using System.Windows.Forms;
using Microsoft.Office.PowerPoint.STAMP.Common;

namespace Microsoft.Office.PowerPoint.STAMP.Controls
{
    /// <summary>
    /// The values currently selected on the <see cref="FormattingToolbar"/>.
    /// </summary>
    public class FormattingToolbarSelection
    {
        private readonly FontFamily fontFamily;
        private readonly CaptionFontSize fontSize;
        private readonly HorizontalAlignment? alignment;
        private readonly bool? isItalic;
        private readonly bool? isBold;
        private readonly bool? isUnderline;
        private readonly Color? fontColor;
        private readonly Color? backgroundColor;

        /// <summary>
        /// Initializes a new instance of the <see cref="FormattingToolbarSelection"/> class.
        /// </summary>
        /// <param name="fontFamily">The selected font.</param>
        /// <param name="fontSize">Size of the font.</param>
        /// <param name="alignment">The alignment.</param>
        /// <param name="isItalic">if set to <c>true</c> [is italic].</param>
        /// <param name="isBold">if set to <c>true</c> [is bold].</param>
        /// <param name="isUnderline">if set to <c>true</c> [is underline].</param>
        /// <param name="fontColor">Color of the font.</param>
        /// <param name="backgroundColor">Color of the background.</param>
        public FormattingToolbarSelection(FontFamily fontFamily, CaptionFontSize fontSize, HorizontalAlignment? alignment, bool? isItalic, bool? isBold, bool? isUnderline, Color? fontColor, Color? backgroundColor)
        {
            this.fontFamily = fontFamily;
            this.backgroundColor = backgroundColor;
            this.fontColor = fontColor;
            this.fontSize = fontSize;
            this.alignment = alignment;
            this.isItalic = isItalic;
            this.isBold = isBold;
            this.isUnderline = isUnderline;
        }

        /// <summary>
        /// Gets a value indicating whether the selected font should be underlined.
        /// </summary>
        public bool? IsUnderline
        {
            get { return isUnderline; }
        }

        /// <summary>
        /// Gets a value indicating whether the selected font should be bold.
        /// </summary>
        public bool? IsBold
        {
            get { return isBold; }
        }

        /// <summary>
        /// Gets a value indicating whether the selected font should be italic.
        /// </summary>
        public bool? IsItalic
        {
            get { return isItalic; }
        }

        /// <summary>
        /// Gets a value indicating the alignment of the selected font.
        /// </summary>
        public HorizontalAlignment? Alignment
        {
            get { return alignment; }
        }

        /// <summary>
        /// Gets a value indicating the size of the selected font.
        /// </summary>
        public CaptionFontSize FontSize
        {
            get { return fontSize; }
        }

        /// <summary>
        /// Gets a value indicating the family of the selected font.
        /// </summary>
        public FontFamily FontFamily
        {
            get { return fontFamily; }
        }

        /// <summary>
        /// Gets the default formatting toolbar selection.
        /// </summary>
        public static FormattingToolbarSelection Default
        {
            get { return new FormattingToolbarSelection(FontService.DefaultFont, CaptionFontSize.Auto, null, false, false, false, 
                Properties.Settings.Default.DefaultFontColor, Properties.Settings.Default.DefaultBackgroundColor); }
        }

        /// <summary>
        /// Gets the color of the font.
        /// </summary>
        public Color? FontColor
        {
            get { return fontColor; }
        }

        /// <summary>
        /// Gets the color of the background.
        /// </summary>
        public Color? BackgroundColor
        {
            get { return backgroundColor; }
        }
    }
}